package com.cloudkinto.service.orderoutput;

import com.cloudkinto.common.web.PageResult;
import com.cloudkinto.common.web.SingleResult;
import com.cloudkinto.entity.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cloudkinto.extentity.order.LabellaOrderTrackNumberDto;
import com.cloudkinto.service.finance.vo.IdAndNameEntity;
import com.cloudkinto.service.orderoutput.importVo.OrderImportErrorVo1;
import com.cloudkinto.service.orderoutput.openapivo.OpenApiOrderOutputAddReq;
import com.cloudkinto.service.orderoutput.vo.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * service接口
 * </p>
 *
 * @author 张永远
 * @since 2020-06-04
 */
public interface OrderOutputService extends IService<OrderOutputDo> {

    SingleResult addInit(Long currentUserId, Long companyId);

    String add(OrderOutputAddReq req, Long userId);

    String openApiAddCatchExcption(OpenApiOrderOutputAddReq req, Long companyId, Long userId);

    SingleResult openApiAdd(OpenApiOrderOutputAddReq req, Long companyId, Long userId);


    SingleResult openApiAdd(OpenApiOrderOutputAddReq req, Long companyId, Long userId, boolean checkOrderNo);

    SingleResult updateInit(Long id);

    OrderOutputUpdateReq update(OrderOutputUpdateReq updateVo, Long userId);

    String cutOffCatchException(Long id, Long userId, Long companyId);

    void cutoff(Long id, Long userId, Long companyId);

    SingleResult salesReturnInit(Long id);

    void salesReturn(OrderOutputSalesReturnReq req, Long userId, Long companyId);

    int delete(Long id, Long userId);

    OrderOutputDetailRes detail(Long id);

    SingleResult pageInit(Long companyId, Long currentUserId);

    List<OrderOutputListRes> getList(Map<String, String> map);

    PageResult getListPage(Map<String, String> map);

    List<OrderImportErrorVo1> dealForLabella(List<OrderOutputExcelImportNew> excelNewImportList);

    List<LabellaOrderTrackNumberDto> labellaGetTrackNumber(List<String> platformOrderNos);

    SingleResult dealwithExcel(MultipartFile file, Integer tempType, Long shopId, Integer storageId, Long userid, Long companyId);

    void exportExcel(Map<String, String> map, OrderOutputExcelReq req, HttpServletResponse response) throws IOException;

    List<String> addRakutenList(List<OrderOutputAddReq> orderOutputAddReqList, Long currentUserId);

    List<String> addQoo10List(List<OrderOutputAddReq> orderOutputAddReqList, Long currentUserId);

    List<String> addAmazonVDFList(Iterable<OrderOutputAddReq> orderOutputAddReqList, Long userId);

    List<String> addAmazonList(Iterable<OrderOutputAddReq> orderOutputAddReqList, Long userId);

    List<String> addYahooList(Iterable<OrderOutputAddReq> orderOutputAddReqList, Long userId);

    List<String> addShopifyList(Iterable<OrderOutputAddReq> orderOutputAddReqList, Long userId);

    double[] getMaxPackageSize(Long storageId, List<OrderOutputProductDo> productDoList, boolean split, Long trackId, Long companyId, Map<Long, ProductInfoDo> productmMap, StorageDo storageDo);

//    List<OrderOutputPackageDetailDo> getPackageSizeInfoCount(List<OrderOutputProductDo> productDoList, Long storageId);

    // int jugSizeType(double[] size, Long storageId, List<OrderOutputProductDo> productDoList);

    boolean yamatoExpressSmallSize(double[] size, Long storageId, Integer cod, Integer shipmentType);

    boolean jpostExpressSize(double[] size, Long storageId, Integer cod, Integer shipmentType);

    OrderOutputDetailRes getTrackInfo(String orderNo, Long companyId);

    SingleResult orderRepeat(Long id, Long currentUserId, Long companyId);

    SingleResult cancelOrder(String outOrderNumber, Long currentUserId);

    List<IdAndNameEntity> getTrackWay();

    Object updateStock(OrderOutputUpdateReq req, Long userId);

    Long getProductId(String sellerSku, Long companyId, int type);

    void updateOrderOutCheckStatus();

    /**
     * 根据一件代发订单id导出FD订单标签文件PDF
     * @param ids 一件代发订单id组
     * @param response 响应
     */
    void exportShippingLabelPdfByOutputId(Long[] ids, HttpServletResponse response);

    Collection<String> addTiktokList(List<OrderOutputAddReq> orderOutputAddReqList, Long userId);
}
